// $Id: assert.hpp 2 2009-09-02 08:47:42Z joseph2002 $
/*
 * Copyright 2008 Joseph Wu
 * Distributed under the Boost Software License, Version 1.0.
 * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 *
 * For more information, see http://xpcomplus.sourceforge.net
 */

#ifndef XPCOM_ASSERT_HPP
#define XPCOM_ASSERT_HPP

// Use boost assert now, may be changed

#include <xpcom/config.hpp>
#include <boost/assert.hpp>
#ifdef XPCOM_ENABLE_ASSERT_PTR_THROW
#include <xpcom/exception.hpp>
#include <xpcom/result_code.hpp>
#endif // XPCOM_ENABLE_ASSERT_PTR_THROW

#define XPCOM_ASSERT BOOST_ASSERT

#ifdef XPCOM_ENABLE_ASSERT_PTR_THROW
#  define XPCOM_ASSERT_PTR(p) \
    if (p) ; else ::xpcom::throw_exception(NS_ERROR_NULL_POINTER)
#else
#  define XPCOM_ASSERT_PTR(p) XPCOM_ASSERT(!!(p))
#endif // XPCOM_ENABLE_ASSERT_PTR_THROW

#endif // XPCOM_ASSERT_HPP
